Skip to content

Support specific aliases for PnP step labels #3461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 13, 2025
Merged

Conversation

rdonigian
Copy link
Contributor

This will remedy the custom step header error for a leadership approved list of alternative headers by replacing custom steps with standard ones.

@rdonigian rdonigian requested a review from CarsonF as a code owner May 23, 2025 18:50
Copy link

coderabbitai bot commented May 23, 2025

📝 Walkthrough

Walkthrough

The findStepColumns function was refactored to use Map and Set for internal tracking and introduced a normalization map for alias step headers to standardize step names before fuzzy matching. The return type was changed to ReadonlyMap<Step, Column>. Additionally, parameter types in related functions were updated from Record to ReadonlyMap with corresponding access method changes. No exported function signatures were altered.

Changes

File(s) Change Summary
src/components/pnp/findStepColumns.ts Refactored findStepColumns to use Map and Set; added alias normalization map; extracted fuzzy matching logic; changed return type to ReadonlyMap.
src/components/product-progress/step-progress-extractor.service.ts
src/components/product/product.extractor.ts
Updated parameter types from Record<Step, Column> to ReadonlyMap<Step, Column> in parsing functions; changed access from bracket notation to .get() method.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/components/pnp/findStepColumns.ts (1)

77-79: Remove commented-out code.

The commented-out code appears to be unused and should be removed to maintain code cleanliness.

Apply this diff to remove the commented code:

-    // const isApproved = ApprovedCustomSteps.get(
-    //   label.trim().toLowerCase(),
-    // );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a67003 and 1253560.

📒 Files selected for processing (1)
  • src/components/pnp/findStepColumns.ts (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: Generate (base)
  • GitHub Check: Generate (head)
  • GitHub Check: Clean
  • GitHub Check: E2E Tests (neo4j 6/6)
  • GitHub Check: E2E Tests (neo4j 3/6)
  • GitHub Check: E2E Tests (neo4j 5/6)
  • GitHub Check: E2E Tests (neo4j 4/6)
  • GitHub Check: lint
  • GitHub Check: E2E Tests (neo4j 2/6)
  • GitHub Check: E2E Tests (neo4j 1/6)
  • GitHub Check: Unit
🔇 Additional comments (1)
src/components/pnp/findStepColumns.ts (1)

48-54: LGTM! Correct normalization of sheet labels.

The normalization logic for sheet labels is implemented correctly - it properly converts custom string headers from the spreadsheet to standard Step enum values before fuzzy matching.

@sethmcknight sethmcknight linked an issue May 27, 2025 that may be closed by this pull request
@rdonigian rdonigian force-pushed the step-header-mapping branch 2 times, most recently from 36f84c9 to 79984d3 Compare May 27, 2025 18:10
CarsonF and others added 5 commits June 11, 2025 13:39
- Map better represents key optionality
- Set lets us not use lodash without
- chooseStep moves that BL to a pure function
These should be matched exactly and not go
through the fuzzy matching
If there are two columns with "first draft" then the second will become a non-standard step problem.
@CarsonF CarsonF force-pushed the step-header-mapping branch from 79984d3 to b83b214 Compare June 11, 2025 18:48
@CarsonF CarsonF changed the title Create Approved Step Header Mapping Support specific aliases for PnP step labels Jun 11, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
src/components/product-progress/step-progress-extractor.service.ts (1)

81-88: 💡 Verification agent

🛠️ Refactor suggestion

🧩 Analysis chain

! on .get() risks runtime crash when a column is missing

planningStepColumns.get(step)! will throw if the step wasn’t found in the planning sheet (e.g. header typo, alias not mapped, or a step removed later).
Gracefully skip (or log a problem) instead of crashing the extraction.

-        const fiscalYear = pnp.planning.cell(
-          planningStepColumns.get(step)!,
-          planningRow,
-        );
+        const planCol = planningStepColumns.get(step);
+        if (!planCol) {
+          // Column not present – record and skip instead of crashing.
+          result.addProblem?.('MissingPlanningStepColumn', cell, { step });
+          return [];
+        }
+        const fiscalYear = pnp.planning.cell(planCol, planningRow);

🏁 Script executed:

#!/bin/bash
rg "planningStepColumns" -n src/components/product-progress/step-progress-extractor.service.ts

Length of output: 347


🏁 Script executed:

#!/bin/bash
# Locate and display the parseProgressRow function to understand its callback context
rg -n "parseProgressRow" -A20 -B10 src/components/product-progress/step-progress-extractor.service.ts

Length of output: 1329


🏁 Script executed:

#!/bin/bash

# Display the full parseProgressRow callback to see its return structure
sed -n '67,140p' src/components/product-progress/step-progress-extractor.service.ts

# Find the definition of PnpProgressExtractionResult to verify addProblem exists
rg -n "PnpProgressExtractionResult" -A5 -B5 -n src

Length of output: 15751


Handle missing planningStepColumns entry to prevent runtime crash

A non-null assertion on planningStepColumns.get(step)! will throw if that step isn’t mapped in the planning sheet. We should guard against a missing column, log the issue, and skip the step.

• File: src/components/product-progress/step-progress-extractor.service.ts
• Location: inside the parseProgressRow callback where entries(stepColumns).flatMap is used (around lines 81–88)

Suggested diff:

     const steps = entries(stepColumns).flatMap<StepProgressInput>(
       ([step, column]) => {
-        const fiscalYear = pnp.planning.cell(
-          planningStepColumns.get(step)!,
-          planningRow,
-        );
+        const planCol = planningStepColumns.get(step);
+        if (!planCol) {
+          // Missing planning sheet column for this step – record and skip.
+          const progCell = sheet.cell(column, row);
+          result.addProblem('MissingPlanningStepColumn', progCell, { step });
+          return [];
+        }
+        const fiscalYear = pnp.planning.cell(planCol, planningRow);
         const cell = sheet.cell(column, row);
         if (
           !isGoalStepPlannedInsideProject(pnp, fiscalYear, step, result) ||
           isProgressCompletedOutsideProject(pnp, cell, step, result)
         ) {
           return [];
         }

         return { step, completed: progress(cell) };
       },
     );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79984d3 and b83b214.

📒 Files selected for processing (3)
  • src/components/pnp/findStepColumns.ts (2 hunks)
  • src/components/product-progress/step-progress-extractor.service.ts (2 hunks)
  • src/components/product/product.extractor.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/pnp/findStepColumns.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/components/product/product.extractor.ts (1)
src/common/xlsx.util.ts (1)
  • Column (373-409)
src/components/product-progress/step-progress-extractor.service.ts (1)
src/common/xlsx.util.ts (1)
  • Column (373-409)
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: lint
  • GitHub Check: Generate (base)
  • GitHub Check: Generate (head)
  • GitHub Check: E2E Tests (neo4j 5/6)
  • GitHub Check: E2E Tests (neo4j 2/6)
  • GitHub Check: E2E Tests (neo4j 3/6)
  • GitHub Check: E2E Tests (neo4j 1/6)
  • GitHub Check: E2E Tests (neo4j 6/6)
  • GitHub Check: E2E Tests (neo4j 4/6)
  • GitHub Check: Clean
  • GitHub Check: Unit
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
src/components/product-progress/step-progress-extractor.service.ts (1)

69-71: Immutable maps 👍

Switching to ReadonlyMap is a solid improvement—prevents accidental mutation and makes intent explicit.

src/components/product/product.extractor.ts (1)

83-86: Consistent immutability 👍

The parameter type change to ReadonlyMap mirrors the progress extractor and keeps data structures consistent across services.

@CarsonF
Copy link
Member

CarsonF commented Jun 11, 2025

@rdonigian want to review my changes?

@CarsonF CarsonF requested a review from bryanjnelson June 12, 2025 19:58
@CarsonF CarsonF merged commit 6cdf774 into develop Jun 13, 2025
18 checks passed
@CarsonF CarsonF deleted the step-header-mapping branch June 13, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CF - Add additional mapping of PnP Product Step Headers
3 participants